package top.toptimus.dto.order.orderSync;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import top.toptimus.util.DateTimeUtil;
import top.toptimus.util.ValueUtil;

import java.util.Date;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class QcDTO {
    private int QC_ID;
    private int QC_STYLE_ID;
    private int QC_OPERATING_ID;
    private String QC_STYLE_BAR_CODE;
    private int QC_ITEM_ID;
    private String QC_ITEM;
    private String QC_CONTENT;
    private int QC_SORT;
    private String QC_ITEM_CD;
    private String QC_ITEM_VALUE;
    private String QC_ITEM_REAL_VALUE;
    private String QC_ITEM_CHECK;
    private String QC_FIT_VALUE;
    private int ENABLE_FLAG;
    private int DELETE_FLAG;
    private String REMARKS;
    private int VERSION;
    private Date CREATE_DATE;
    private Date UPDATE_DATE;
    private int CREATE_USER;
    private int UPDATE_USER;

    public QcDTO(
            String QC_STYLE_ID
            , String QC_STYLE_BAR_CODE
            , String QC_ITEM_ID
            , String QC_ITEM
            , String QC_ITEM_CD
            , String QC_ITEM_VALUE
            , String QC_ITEM_REAL_VALUE
    ) {

        this.QC_STYLE_ID = ValueUtil.IntNullValue(QC_STYLE_ID);
        this.QC_OPERATING_ID = 34;
        this.QC_STYLE_BAR_CODE = QC_STYLE_BAR_CODE;
        this.QC_ITEM_ID = ValueUtil.IntNullValue(QC_ITEM_ID);
        this.QC_ITEM = QC_ITEM;
        this.QC_ITEM_CD = QC_ITEM_CD;
        this.QC_ITEM_VALUE = QC_ITEM_VALUE;
        this.QC_ITEM_REAL_VALUE = QC_ITEM_REAL_VALUE;
        this.QC_ITEM_CHECK = "0";
        this.ENABLE_FLAG = 1;
        this.DELETE_FLAG = 0;
//                REMARKS
        this.VERSION = 1;
        this.CREATE_DATE = DateTimeUtil.getCurrentDate();
    }

    public String buildInsertSQL() {
        return "insert into s_style_quality_control_p\n" +
                "(QC_STYLE_ID,QC_OPERATING_ID,QC_STYLE_BAR_CODE,QC_ITEM_ID,QC_ITEM,QC_ITEM_CD,QC_ITEM_VALUE,QC_ITEM_REAL_VALUE,QC_ITEM_CHECK,ENABLE_FLAG,DELETE_FLAG,VERSION,CREATE_DATE)\n" +
                "values ('" + this.QC_STYLE_ID + "'\n" +
                ",'" + this.QC_OPERATING_ID + "'\n" +
                ",'" + this.QC_STYLE_BAR_CODE + "'\n" +
                ",'" + this.QC_ITEM_ID + "'\n" +
                ",'" + this.QC_ITEM + "'\n" +
                ",'" + this.QC_ITEM_CD + "'\n" +
                ",'" + this.QC_ITEM_VALUE + "'\n" +
                ",'" + this.QC_ITEM_REAL_VALUE + "'\n" +
                ",'" + this.QC_ITEM_CHECK + "'\n" +
                ",'" + this.ENABLE_FLAG + "'\n" +
                ",'" + this.DELETE_FLAG + "'\n" +
                ",'" + this.VERSION + "'\n" +
                ",'" + DateTimeUtil.convertToDate(this.CREATE_DATE) + "');";
    }
}
